<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
 <%@ taglib prefix="zi" uri="http://gson.cn/jsp/jstl/mytags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%= basePath%>">
<meta http-equiv="Content-Type" content="textml; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="static/css/JDcar.css"/>
</head>
<body style="overflow:-Scroll;overflow-x:hidden">
	<div class="shopbigbox">
		<!--头部-->
		<div class="top_bigbox">
			<div class="top_box">

				<ul class="top_dh">
					<li>
						<a href="#">${users.user_name}</a>
						<a class="kkk"></a>
					</li>
					<li>
						<a href="#">免费注册</a>
						<a class="gan">|</a>
					</li>
					<li>
						<a href="index1">我的订单</a>
						<a class="gan">|</a>
					</li>
					<li>
						<a href="#" class="arrow">我的京东<i><s>♢</s></i>&nbsp;&nbsp;</a>
						<a class="gan">|</a>
					</li>
					<li>
						<a href="#">京东会员</a>
						<a class="gan">|</a>
					</li>
					<li>
						<a href="#">企业采购</a>
						<a class="gan">|</a>
					</li>
					<li>
						<a href="#" class="arrow">客户服务<i><s>♢</s></i>&nbsp;&nbsp;</a>
						<a class="gan">|</a>
					</li>
					<li>
						<a href="#" class="arrow">网站导航<i><s>♢</s></i>&nbsp;&nbsp;</a>
						<a class="gan">|</a>
					</li>
					<li>
						<a href="#">手机京东</a>
					</li>
				</ul>
			</div>
		</div>

		
		<!--logo标志-->
		<div class="shoplogo">
			<div class="logodiv"><div class="car">购物车</div></div>
			<div class="shopsou">
				<div class="suo">
					<input type="text" class="chang"  placeholder="自营"/>
					<input type="button" class="btn" value="搜索"/>
				</div>
			</div>
		</div>
		
		<!-- 购物车主要信息-->
		<div class="bigbody">
		<c:if test="${empty carlist}" var="kong">
		
			<div class="minbo">
				<div class="mimi">
					<ul class="bodyul">
						<li class="txt">购物车空空的哦~，去看看心仪的商品吧~</li>
						<li class="mt"><a href="Sy_lb">去购物></a></li>
					</ul>
				</div>
			</div>
		</c:if>	
		<c:if test="${not kong}">
				<div class="yigou">
				<div class="yititle"><div class="bububu"><a href="">全部商品</a></div></div>
				
				<div class="bigyii">
				<div class="yiyi">
					<div class="kung"><input type="checkbox" class="qunone1" name="quan1" checked="checked" /><div class="qunoneo"> 全选</div></div>
					<div class="goodsn">商品</div>
					<div class="xiaott">
					
					<div class="danjiaa">单价</div>
					<div class="shul">数量</div>
					<div class="xiaoshi">小计</div>
					<div class="caozuo">操作</div>
					</div>
				</div>
				
				<div class="yiyi2"> 
					
					<div class="qijian">
						<input type="checkbox" class="chkshop" checked="checked" />
						<div class="pppp"><a href="">京东官方旗舰店</a>
						<div class="tututu"></div></div>
						
					</div>
				</div>
				<c:forEach items="${carlist}" var="nice">
				<div class="shangpxiang">
					<div class="inputgou"><input type="checkbox" ${nice.car_xuanzhong==1?'checked':''} class="qunone" gid="${nice.car_id}"/><input type="hidden" class="hide_id" value="${nice.car_id}"></div>
					<div class="xiangqing">
						<img src="${nice.picture_path}" width="80px">
						<div class="xxxx"><a href="">${nice.shoop_Product}</a></div>
						<div class="qitian"><img src="static/img/qqqqq.png"/></div>
					</div>
					<div class="nulldiv"></div>
					<div class="danxiang">￥<span gid="${nice.car_id}">${nice.shoop_price}</span></div>
					<div class="shuliang">
						<a href="jiajianSe?jian=1&shuliang=${nice.car_gounum}&id=${nice.car_id}&jiage=${nice.shoop_price}" class="jianhao">-</a>
						<input type="text" class="pipi" value="${nice.car_gounum}" gid="${nice.car_id}"/>
						<a href="jiajianSe?jia=1&shuliang=${nice.car_gounum}&id=${nice.car_id}" class="jiashu">+</a>
					</div>
					<div class="goujiage">
						<div class="jojojo">￥${nice.shoop_price*nice.car_gounum}</div>
						<div class="zhongl">1.31kg</div>
					</div>
					<div class="delet">
						<ul>
							<li><a href="cardelete?cid=${nice.car_id}" name="remvede">删除</a></li>
							<li><a href="">移到我的关注</a></li>
							<li><a href="">加到我的关注</a></li>
						</ul>
					</div>
				</div>
				</c:forEach>
				<div class="jiesuank">
					<div class="quanxuank"><input type="checkbox" class="qunone2" /><div class="quntwo"> 全选</div></div>
					<div class="wenzia">
						<ul>
							<li><a href="">删除选中的商品</a></li>
							<li><a href="">移到我的关注</a></li>
							<li><a href="">清除下柜商品</a></li>
						</ul>
					</div>
					<div class="jiajia">
						<div class="zongl">已选择<span class="nimei">${numshu}</span>件商品</div>
						<div class="zongjiaa">总价：<span>￥${zong}</span><div class="pictuer"></div><input type="hidden" class="momo" value="${zong}"></div>
						<div class="deletbtn"><input type="button" onclick="aaa()" value="去结算"/></div>
					</div>
				</div>
				</div>
			</div>
			</c:if>
		</div>
		<script type="text/javascript">
			function aaa() {
				location.href="balancesel";
			}
		</script>
		<div style="clear:both"></div>
		<!-- 底部 -->
		<!--底部第一个盒子-->
			<div class="dinghead">
				<div class="dingone">
				<ol>
					<li>
						<div class="duop">
							<div class="duowen">品类齐全，轻松购物</div>
						</div>
					</li>
					
					<li>
						<div class="kuaip">
							<div class="duowen">多仓直发，极速配送</div>
						</div>
					</li>
					
					<li>
						<div class="haop">
							<div class="duowen">正品行货，精致服务</div>
						</div>
					</li>
					
					<li>
						<div class="shengp">
							<div class="duowen">天天低价，畅选无忧</div>
						</div>
					</li>
				</ol>
				</div>
				
				<div class="headzhi">
					<div class="mindi">
					<dl class="fore1">
						<dt>购物指南</dt>
						<dd><a href="">购物流程</a></dd>
						<dd><a href="">会员介绍</a></dd>
						<dd><a href="">生活旅行/团购</a></dd>
						<dd><a href="">常见问题</a></dd>
						<dd><a href="">大家电</a></dd>
						<dd><a href="">联系客服</a></dd>
					</dl>
					
					<dl class="fore1">
						<dt>配送方式</dt>
						<dd><a href="">上门自提</a></dd>
						<dd><a href="">211限时达</a></dd>
						<dd><a href="">配送服务查询</a></dd>
						<dd><a href="">配送费收取标准</a></dd>
						<dd><a href="">海外配送</a></dd>
						
					</dl>
					
					<dl class="fore1">
						<dt>支付方式</dt>
						<dd><a href="">货到付款</a></dd>
						<dd><a href="">在线支付</a></dd>
						<dd><a href="">分期付款</a></dd>
						<dd><a href="">邮局汇款</a></dd>
						<dd><a href="">公司转账</a></dd>
						<dd><a href=""></a></dd>
					</dl>
					
					<dl class="fore1">
						<dt>售后服务</dt>
						<dd><a href="">售后政策</a></dd>
						<dd><a href="">价格保护</a></dd>
						<dd><a href="">退款说明</a></dd>
						<dd><a href="">返修/退换货</a></dd>
						<dd><a href="">取消订单</a></dd>
						<dd><a href=""></a></dd>
					</dl>
					
					<dl class="fore1">
						<dt>特色服务</dt>
						<dd><a href="">夺宝岛</a></dd>
						<dd><a href="">DIY装机</a></dd>
						<dd><a href="">延保服务</a></dd>
						<dd><a href="">京东E卡</a></dd>
						<dd><a href="">京东通信</a></dd>
						<dd><a href="">京东JD+</a></dd>
					</dl>
					</div>
				</div>
			</div>
			
			<!--底部第二个盒子-->
			<div class="dibu">
				<p class="dibu1">
					<a href="">关于我们</a><span>|</span>
					<a href="">联系我们</a><span>|</span>
					<a href="">联系客服</a><span>|</span>
					<a href="">合作招商</a><span>|</span>
					<a href="">商家帮助</a><span>|</span>
					<a href="">营销中心</a><span>|</span>
					<a href="">手机京东</a><span>|</span>
					<a href="">友情链接</a><span>|</span>
					<a href="">销售联盟</a><span>|</span>
					<a href="">京东社区</a><span>|</span>
					<a href="">风险监测</a><span>|</span>
					<a href="">隐私政策</a><span>|</span>
					<a href="">京东公益</a><span>|</span>
					<a href="">English Site</a><span>|</span>
					<a href=""> Contact Us</a>
				</p>
				
			<div class="bodydi2">
				<p class="dibu2">
					<a href="">京公网安备 11000002000088号</a><span>|</span>
					<span class="wenwenwen">京ICP证070359号  </span><span>|</span>
					<a href="">互联网药品信息服务资格证编号(京)-经营性-2014-0008</a><span>|</span>
					<span class="wenwenwen">新出发京零 字第大120007号</span>
				</p>
				
				<p class="dibu3">
					<span class="wenwenwen">互联网出版许可证编号新出网证(京)字150号  </span><span>|</span>
					<a href="">出版物经营许可证</a><span>|</span>
					<a href="">网络文化经营许可证京网文[2014]2148-348号</a><span>|</span>
					<span class="wenwenwen">违法和不良信息举报电话：4006561155</span>
				</p>
				
				<p class="dibu4">
					Copyright © 2004 - 2018  京东JD.com 版权所有  |
					消费者维权热线：4006067733    <a href="">经营证照</a>
				</p>
				
				<p class="dibu5">
					京东旗下网站：京东钱包  |<a href="">京东云</a>
				</p>
				
				<p class="imglogo">
					<a href="" class="logo"></a>
					<a href="" class="logo2"></a>
					<a href="" class="logo3"></a>
					<a href="" class="logo4"></a>
					<a href="" class="logo5"></a>
					<a href="" class="logo6"></a>
				</p>
			</div>
			</div>
						
	</div>
	</body>
</html>
<script src="static/js/jquery-3.1.0.js"></script>
<script type="text/javascript">
/* 	$(document).ready(function(){
		$(".qunone1").click(function(){
			var total_price=0;
			var total_num=0;
			
			//如果全选按钮被选中
			if($(this).is(':checked')){
				$(".qunone").each(function(){
					$(this).attr("checked",'true');   //选中
					var gid=$(this).attr('gid');
					var price=$("span[gid='"+gid+"']").html();
					var num=$("input[type='text'][gid='"+gid+"']").val();
					total_num+=parseInt(num);
					total_price+=(parseFloat(price)*parseInt(num));
				});
				alert("总数量："+total_num+",总价格是："+total_price)
			}else{
				//$(".qunone").each(function(){
					//$(this).removeAttr("checked");   
				//});
				$(this).attr("checked",'false'); 
			}
			
			
			
		});
	}); */
	
	$(function(){
		var total_price=parseInt($('.zongjiaa').find('.momo').val());	
		var total_num=parseInt($('.nimei').html());
		$(".qunone1").click(function(){
			if(this.checked){
				$(".chkshop").each(function(){this.checked=true});
				$(".qunone").each(function(){
					this.checked=true;
					var gid=$(this).attr('gid');
					var price=$("span[gid='"+gid+"']").html();
					var num=$("input[type='text'][gid='"+gid+"']").val();
					total_num+=parseInt(num);
					total_price+=(parseFloat(price)*parseInt(num));
					$('.nimei').html(total_num);
					$('.zongjiaa').find('span').html(total_price);
					
				});
			}else{
				$(".chkshop").each(function(){this.checked=false});
				$(".qunone").each(function(){
					this.checked=false;
					total_price=0;
					total_num=0;
					$('.nimei').html(total_num);
					$('.zongjiaa').find('span').html(total_price);
				});
			}
		});
		
		$(".qunone").click(function(){
			
			var carid=$(this).parent().find('.hide_id').val();
			if(this.checked){	
				var gid=$(this).attr('gid');
				var price=$("span[gid='"+gid+"']").html();
				var num=$("input[type='text'][gid='"+gid+"']").val();
				total_num+=parseInt(num);
				total_price+=(parseFloat(price)*parseInt(num));
				$('.nimei').html(total_num);
				$('.zongjiaa').find('span').html(total_price);
			alert(carid);
				$.post("carcheckedse",{
				hideattr:carid,
				check:this.checked
				},function(data){
					
				});
			}
			else{
				var gid=$(this).attr('gid');
				var price=$("span[gid='"+gid+"']").html();
				var num=$("input[type='text'][gid='"+gid+"']").val();
				total_num=total_num-parseInt(num);
				total_price=total_price-parseFloat((parseFloat(price)*parseInt(num)));
				$('.nimei').html(total_num);
				$('.zongjiaa').find('span').html(total_price);
				$.post("carcheckedse",{
					hideattr:carid,
					check:this.checked
					},function(data){
						
					});
				}
			
		});
	
	});
</script>
